package com.example.bbgds.test;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.Toast;

/**
 * Created by bbgds on 2016/3/1.
 */
public class View1 extends RelativeLayout{
    public View1(Context context) {
        this(context, null);
    }

    public View1(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public View1(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        View.inflate(context, R.layout.layout1, this);
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                Toast.makeText(getContext(), "click btn", Toast.LENGTH_SHORT).show();
            }
        });
    }
}
